package com.zz.parkingsystem.service.impl;

import com.zz.parkingsystem.dto.InsDTO;
import com.zz.parkingsystem.entity.Checkon;
import com.zz.parkingsystem.entity.Inspector;
import com.zz.parkingsystem.mapper.CheckonMapper;
import com.zz.parkingsystem.mapper.InspectorMapper;
import com.zz.parkingsystem.mapper.SectionMapper;
import com.zz.parkingsystem.service.PCInsService;
import com.zz.parkingsystem.vo.AllInsVO;
import com.zz.parkingsystem.vo.BaseInsOrderVO;
import com.zz.parkingsystem.vo.BaseInsVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class PCInsServiceImpl implements PCInsService {
    @Resource
    private InspectorMapper inspectorMapper;
    @Resource
    private CheckonMapper checkonMapper;
    @Resource
    private SectionMapper sectionMapper;


    @Override
    public int updateInsStatusE(Long id) {
        return inspectorMapper.updateInsStatusE(id);
    }

    @Override
    public int updateInsStatusJ(Long id) {
        return inspectorMapper.updateInsStatusJ(id);
    }

    @Override
    public List<Checkon> selectCheck() {
        return checkonMapper.selectCheck();
    }

    @Override
    public List<Checkon> getAllCheck(Long id) {
        return checkonMapper.getAllCheck(id);
    }

    @Override
    public List<Inspector> getOrderIns(Long id) {
        return inspectorMapper.getOrderIns(id);
    }

    @Override
    public BaseInsVO getBaseIns(Long id) {
        return inspectorMapper.getBaseIns(id);
    }

    @Override
    public Long getCount(InsDTO insDto) {
        return inspectorMapper.getCount(insDto);
    }

    @Override
    public List<AllInsVO> getAllInsMes(InsDTO insDto) {
        return inspectorMapper.getAllInsMes(insDto);
    }

    @Override
    public int deleteByPrimaryKey(Long id) {
        return inspectorMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insertSelective(Inspector record) {
        Date date = new Date();
        AllInsVO a = new AllInsVO();
        a.setInsCreatedTime(date);
        Integer insId = record.getInsId();
        if(insId==null){
            int i = inspectorMapper.insertSelective(record);
            return i;
        }else {
            return 0;
        }
    }

    @Override
    public Inspector selectByPrimaryKey(Long id) {
        return inspectorMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Inspector record) {
        return inspectorMapper.updateByPrimaryKeySelective(record);
    }
}
